<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>实验详情</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		function viewDetail(id,programName){
			console.info(id);
			$.ajax({
				type: "POST",
				url: "${ctx}/scene/sceneNetwork/getSubnetList",
				data: {
					ids:id
				},
				<%--data: {id:${"#id"}.val()},--%>
				success: function (subnetList) {
					for (var i = 0; i < subnetList.length; i++) {
						$("#viewDetailBoxItem").append("<li>" + subnetList[i].subnetName+' '+subnetList[i].cidr + "</li>");

					}


				},
				error:function(){
					alert("error");
				}
			});
			$.jBox($("#viewDetailBox").html(), {title:"查看已连接子网", buttons:{"关闭":true}, submit: function(){}});

		}
		function viewInterfaceDetail(id,programName){
			console.info(id);
			$.ajax({
				type: "POST",
				url: "${ctx}/scene/sceneRouter/interfaceList",
				data: {
					ids:id
				},
				<%--data: {id:${"#id"}.val()},--%>
				success: function (subnetList) {
					for (var i = 0; i < subnetList.length; i++) {
						$("#viewDetailBoxItem").append("<li>" + subnetList[i].cidr+'('+subnetList[i].subnetName+')' + "</li>");

					}


				},
				error:function(){
					alert("error");
				}
			});
			$.jBox($("#viewDetailBox").html(), {title:"查看接口", buttons:{"关闭":true}, submit: function(){}});

		}
		function viewRouterTableDetail(id){
			console.info(id);
			$.ajax({
				type: "POST",
				url: "${ctx}/scene/sceneRouter/routerTableList",
				data: {
					ids:id
				},
				<%--data: {id:${"#id"}.val()},--%>
				success: function (routerTableList) {
					for (var i = 0; i < routerTableList.length; i++) {
						$("#routerTable").append("<li>" + routerTableList[i].destination+'(目的cidr)'+'  '+routerTableList[i].nexthop+'(下一跳)' + "</li>");

					}


				},
				error:function(){
					alert("error");
				}
			});
			$.jBox($("#viewRouterTableDetailBox").html(), {title:"查看路由表", buttons:{"关闭":true}, submit: function(){}});

		}
	</script>
	<script type="text/template" id="viewDetailBox">
		<div>
			<ul id="viewDetailBoxItem">
			</ul>
		</div>
	</script>
	<script type="text/template" id="viewRouterTableDetailBox">
		<div>
			<ul id="routerTable">
			</ul>
		</div>
	</script>
</head>
<body>
<ul class="nav nav-tabs">
	<li><a href="${ctx}/scene/sceneEnvironment/">教学实验环境列表</a></li>
	<li class="active"><a href="${ctx}/scene/sceneEnvironment/detail?id=${sceneEnvironment.id}">教学实验环境详情</a></li>
</ul><br/>
<form:form id="inputForm" modelAttribute="resourceCourse" action="" method="post" class="form-horizontal">
	<div class="control-group">
		<label class="control-label">教学实验环境名称：</label>
		<div class="controls">
			<input type="text"  value="${sceneEnvironment.environmentName}" maxlength="64" class="input-xlarge required" readonly/>
		</div>
	</div>

	<div class="control-group">
		<label class="control-label">教学实验环境类型：</label>
		<div class="controls">
			<input type="text"  value="${fns:getDictLabel(sceneEnvironment.environmentType, 'scene_env_type', '')}" maxlength="64" class="input-xlarge required" readonly/>
		</div>
	</div>
	<div class="control-group">
		<label class="control-label">实验时间：</label>
		<div class="controls">
			<input type="text"  value="${fns:getDictLabel(sceneEnvironment.environmentTime, 'scene_env_time', '')}" maxlength="64" class="input-xlarge required" readonly/>
		</div>
	</div>
	<div class="control-group">
		<label class="control-label">标签：</label>
		<div class="controls">
			<input type="text"  value="${sceneEnvironment.label}" maxlength="64" class="input-xlarge required" readonly/>
		</div>
	</div>
	<div id="addTimeDiv" <c:if test="${sceneEnvironment.increaseTimeAllow==1}">hidden</c:if>>
		<div class="control-group">
			<label class="control-label">实验时间增加次数：</label>
			<div class="controls">
				<input type="text"  value="${fns:getDictLabel(sceneEnvironment.increaseNumber, 'scene_env_increase_number', '')}" maxlength="64" class="input-xlarge required" readonly/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">实验每次增加时间：</label>
			<div class="controls">
				<input type="text"  value="${fns:getDictLabel(sceneEnvironment.increaseTime, 'scene_env_increase_time', '')}" maxlength="64" class="input-xlarge required" readonly/>
			</div>
		</div>

	</div>
	<div class="control-group">
		<label class="control-label">备注信息：</label>
		<div class="controls">
			<textarea rows="4" maxlength="255" class="input-xxlarge " readonly>${sceneEnvironment.remarks} </textarea>
		</div>
	</div>
	<div class="control-group">
		<label class="control-label">交换机：</label>
		<div class="controls">
			<table id="contentTable" class="table table-striped table-bordered table-condensed">
				<thead>
				<tr>
					<th>交换机名称</th>
					<th>已连接的子网</th>
				</tr>
				</thead>
				<tbody>
				<c:forEach items="${sceneNetworkList}" var="sceneNetwork" varStatus="status">
					<tr>
						<td>
								${sceneNetwork.networkName}
						</td>

						<td>
								${sceneNetwork.subnetName} ${sceneNetwork.cidr}

						<%--<a href="javascript:viewDetail('${sceneNetwork.id}','${sceneNetwork.networkName}')" title="查看">查看</a>--%>
						</td>


					</tr>
				</c:forEach>
				</tbody>
			</table>
		</div>
	</div>

	<div class="control-group">
		<label class="control-label">路由：</label>
		<div class="controls">
			<table class="table table-striped table-bordered table-condensed">
				<thead>
				<tr>
					<th>路由名称</th>
					<th>接口列表</th>
					<th>路由表</th>
					<th>防火墙</th>

				</tr>
				</thead>
				<tbody>
				<c:forEach items="${sceneRouterList}" var="sceneRouter" varStatus="status">
					<tr>
						<td>
								${sceneRouter.routerName}
						</td>
						<td>
								${sceneRouter.subnetName} ${sceneRouter.cidr}

						</td>
						<td><a href="javascript:viewRouterTableDetail('${sceneRouter.id}','${sceneRouter.routerName}')" title="查看">查看</a></td>
						<td>
							<a href="${ctx}/scene/sceneRouter/getRouterFirewall?routerId=${sceneRouter.id}">查看</a>
						</td>
					</tr>
				</c:forEach>
					<%--<tr>--%>
					<%--<td>--%>
					<%--1--%>
					<%--</td>--%>
					<%--<td>--%>
					<%--abc--%>
					<%--</td>--%>


					<%--</tr>--%>
				</tbody>
			</table>
		</div>
	</div>
	<div class="control-group">
		<label class="control-label">虚拟机：</label>
		<div class="controls">
			<table class="table table-striped table-bordered table-condensed">
				<thead>
				<tr>
					<th>虚拟机名称</th>
					<th>是否为操作机</th>
					<th>固定IP</th>
					<th>虚拟机模板</th>
					<th>虚拟机模板类型</th>
					<th>内存大小(MB)</th>
					<th>VCPU数量</th>
					<th>存储空间(GB)</th>
					<th>虚拟机镜像</th>
					<%--<th>端口</th>--%>

				</tr>
				</thead>
				<tbody>
				<c:forEach items="${sceneVmTemplateList}" var="sceneVmTemplate" varStatus="status">
					<tr>
						<td>
								${sceneVmTemplate.vmName}
						</td>
						<td>
							<c:choose>
								<c:when test="${sceneVmTemplate.isOperateMachine==0}">是</c:when>
								<c:otherwise>否</c:otherwise>
							</c:choose>
						</td>
						<td>
								${sceneVmTemplate.fixedIp}
						</td>
						<td>
								${sceneVmTemplate.name}
						</td>
						<td>
								${fns:getDictLabel(sceneVmTemplate.type, 'scene_vm_type', '')}
						</td>
						<td>
								${sceneVmTemplate.ram}
						</td>
						<td>
								${sceneVmTemplate.vcpus}
						</td>
						<td>
								${sceneVmTemplate.disk}
						</td>
						<td>
								${sceneVmTemplate.imageName}
						</td>
						<%--<td>--%>
								<%--${sceneVmTemplate.portId}--%>
						<%--</td>--%>
					</tr>
				</c:forEach>

				</tbody>
			</table>
		</div>
	</div>
	<div class="form-actions">
		<a class="btn btn-primary" href="${ctx}/scene/sceneEnvironmentInstance/topologyShow?environmentId=${sceneEnvironment.id}" target="_blank">场景拓扑图</a>
		<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
	</div>
</form:form>

</body>
</html>